<?php

namespace common\component;

use yii\base\Behavior;
use yii\db\ActiveRecord;
use yii\web\Controller;

class MyBehavior extends  Behavior{



    public $property='123456';

    public function abc(){

        return '666';
    }



    //将相应事件附加到组件上
    public function events()
    {
        parent::events();
        return [
            Controller::EVENT_BEFORE_ACTION => 'beforeAbc',
        ];
    }

    public function beforeAbc($event)
    {
        // 处理器方法逻辑
//        p($event);
        echo '3333------';
    }



     
}